#ifndef _TASKQUEUE_HH_
#define _TASKQUEUE_HH_
#include<mutex>
#include<condition_variable>
#include<queue>
#include<functional>

using std::function;
using std::queue;
using std::condition_variable;
using std::mutex;

using ele= function<void()>;
class TaskQueue
{
public:
    TaskQueue(int size);
    ~TaskQueue();
    bool isempty();
    bool isfull();
    void push(ele& rhs);
    ele pop();
    void wakeup();
private:
    mutex _mut;
    int _quesize;
    condition_variable _notempty;
    condition_variable _notfull;
    queue<ele> _queue;
    bool _loop;
};

#endif
